package org.lib.postgresqlhello.device;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

/**
 * 测试使用 DeviceMapper
 * @author ben
 * @date 2021-11-04 20:37:28 CST
 */
//@Component
@Slf4j
public class DeviceRunner implements ApplicationRunner {

	@Autowired
	private DeviceMapper dvm;
	
	@Override
	public void run(ApplicationArguments args) throws Exception {
		Device dv = new Device();
		dv.setName("device1");
		dv.setSn(123L);
		int ret1 = dvm.insert(dv);
		log.warn("ret1={}, dv={}", ret1, dv);
		
		Device finddv = dvm.selectById(dv.getId());
		log.warn("finddv={}", finddv);
	}

}
